package com.lsh.payment.core.service.payment.builder;

import com.lsh.payment.api.model.basevo.QueryContent;
import com.lsh.payment.core.model.payment.PayDeal;
import com.lsh.payment.core.strategy.vo.base.BasePayResponse;
import com.lsh.payment.core.strategy.vo.dmallpay.DMallQueryResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Project Name: lsh-payment
 * Created by peter on 16/11/27.
 * 北京链商电子商务有限公司
 * Package
 * desc:
 */
public class DMallQueryBuilder implements QueryBuilder {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    private QueryContent content = new QueryContent();

    private PayDeal updatePaydeal = new PayDeal();

    @Override
    public void parse(BasePayResponse basePayResponse, PayDeal payDeal) {
        content.setTradeId(payDeal.getTradeId());
        content.setChannelTransaction(payDeal.getChannelTransaction());
        content.setPayCode(payDeal.getPayStatus());//TODO:直接赋值,后期需根据查询结果判断赋值
    }

    @Override
    public void createUpdatePaydeal(BasePayResponse basePayResponse, final PayDeal payDeal) {
    }

    private boolean checkParams(DMallQueryResponse dMallQueryResponse, PayDeal payDeal) {
        return true;
    }

    /**
     * 拿到解析后的结果
     *
     * @return
     */
    public QueryContent getResult() {
        return content;
    }

    /**
     * 拿到解析后的结果
     *
     * @return
     */
    public PayDeal getUpdatePaydeal() {
        return updatePaydeal;
    }
}
